<template>
	<section>
		<headers txt="设置昵称"></headers>
		<ul class="mu20 ">
			<li class="bbtm md10 sz30 wallfff flexs plr30  hei100">

				<label class="flex_self mr30">昵称</label>
				<input class="flex1 sz30" v-model="nick" type="text" placeholder="输入新昵称" />

			</li>
		</ul>
		<button class="btns mu30" type="button" @click="nicks">完成</button>
	</section>
</template>

<script>
	import { Toast } from 'mint-ui';
	import { Indicator } from 'mint-ui';
	import Qs from 'qs';
	export default {
		data() {
			return {
				nick: ""
			}
		},
		methods: {
			nicks: function() {
				let v = this;
				if(/\s/.test(v.nick)||!v.nick) {
					Toast("输入不能为空/字符间不能有空格");
				} else {
					Indicator.open({
						text: '请求中，请稍等'
					});
					this.$http.post("/WorkMembers/V1.0/MembersInfoEidt", Qs.stringify({
						"MembersID": this.$store.state.MembersID,
						"Mode": "NikeName",
						"New_Contact": v.nick

					})).then((res) => {
						Indicator.close();
						if(!res.data.Return_ID) {
							let session = JSON.parse(sessionStorage.infos);
							session.Members_NikeName = v.nick;
							sessionStorage.infos = JSON.stringify(session);
							
						}
						Toast(res.data.Return_Mess);

					}).catch((err) => {
						Indicator.close();
						Toast(err);
					});

				}

			}
		},

	}
</script>

<style>

</style>